package com.employee.crud.service;

import com.employee.crud.EmployeeRepository;
import com.employee.crud.UserNotFoundException;
import com.employee.crud.entity.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeService {

    @Autowired
    EmployeeRepository employeeRepository;

    public List<Employee> findAll(){
        return employeeRepository.findAll();
    }

    public int insert(int id,String name,int age,String gender){
        return employeeRepository.insert(id,name,age,gender);
    }

    public void deleteUser(int id){
        employeeRepository.deleteById(id);
    }

    public int update(String name,int age,String gender,int id) {
        return employeeRepository.update(name,age,gender,id);

    }
}
